package com.cdty.chess.service.impl;

import com.cdty.chess.service.WebSocketEventHandler;
import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;

@Component
public class ChatMessageHandler implements WebSocketEventHandler {
    @Override
    public String getEventType() {
        return "chat_message";
    }

    @Override
    public void handleEvent(WebSocketSession session, JsonNode data) {
        String content = data.get("content").asText();
        // 处理聊天消息逻辑
        System.out.println("收到聊天消息：" + content);
    }
}
